<HTML>
<HEAD><link href="main.css" type=text/css rel=stylesheet></HEAD>
<BODY>
<font class="HeaderText">PINTBasic Example #2 - Adding Hotspots, Inventory</font>
<br/>
<br/>
Again, before diving in too deeply into how the code works, I thought I should offer a few definitions and cover a few topics:
<br/>
<br/>
<font class="HeaderText">Hotspot:</font>
<br/>
A Hotspot is a non-visible screen location that can either trigger an event, or can return whether or not the Ego is within the hotspot boundaries.
<br/>
<br/>
<font class="HeaderText">Inventory:</font>
<br/>
The inventory contains items that the ego has collected, and can be used in interacting with the other game elements (such as "GIVE"ing to  someone, or "USE"ing on/with something).
<br/>
<br/>
You can view the example code <a href="../examples/Example2/0.bas">here</a> (0.BAS).
<br/>
<br/>
Building on the code from the first example, the hotspot ("hotRake") is defined:
<br>
<br>
<pre>
  Dim hotRake as Hotspot (10, 62, 10, 17)
</pre>
<br/>
This defines the hotspot at 10, 62, with a width of 10 and a height of 17.  If you use the application PINTRoomViewer.exe (in the /tools/bin directory), and view the source of this room, you will be able to view this hotspot.  It will be displayed on the screen as an orange box in the left-hand side of the screen, in a location below where the rake appears by the old shed.
<br/>
 The item ("g_itmRake") is defined in the "<a href="../examples/Example2/global.bi">globabl.bi</a>" include, and represents the item that can be added/removed from the inventory entity.  Note that an item can only have a 4 character descriptor in the PINT interpreter.
<br/>
<br/>
<font class="HeaderText">-- On_Take Event --</font>
<br/>
The On_Take event is triggered when the "TAKE" action is selected.  
<br/>
<br/>
<pre>
  Event On_Take
       If (Inventory.Contains(g_itmRake)) Then
          Say ("nothing to take")
       Else
          If (hotRake.ContainsEgo()) Then
               Say ("You take the rake")
               Inventory.Add(g_itmRake)
               picRake.Hide()
          End If
       End If
  End Event
</pre>
<br/>
The first check in the event is to see if the inventory already contains the item "RAKE" (g_itmRake).   If it does, then a message is displayed.
<br/>
If the item is not in inventory, the "ContainsEgo" method of the hotspot ("hotRake") is checked to see if it contains the ego object inside the boundaries of the hotspot.  If so then a message is displayed, the item is added to the  inventory, and the picture of the rake ("picRake") is hidden.
</BODY>
</HTML>